#include "stdafx.h"
#include "StateIdle.h"
#include "FSM.h"

StateIdle::StateIdle(FSM *fsm, LifeObject *obj) :FSMState(fsm)
{
	m_object = obj;
	m_stateName = "idle";
	m_stateType = FSM::st_idle;
}


StateIdle::~StateIdle()
{
}

bool StateIdle::Enter()
{
	m_object->m_animate.SetAnimation(m_object->GetAnimIndex_idle(), 0);
	m_object->m_animPosOffset = 0.0f;
	return true;
}

void StateIdle::Run()
{
	switch (m_fsm->GetNextState())
	{
	case FSM::st_dir:
		m_object->SetDir(m_object->m_dirTo);
		m_fsm->SetNextState(FSM::st_idle);
		break;
	case FSM::st_idle:
		break;
	default:
		m_fsm->ChangeToNextState();
		break;
	}
}